/*
 * Created by JFormDesigner on Wed Oct 22 17:00:55 CST 2025
 */

package com.geek.bams.client;

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;


public class MainPanel extends JPanel {

    private ATMClient atm;

    public MainPanel(ATMClient atm) {
        this.atm = atm;
        initComponents();
    }

    //跳转注册界面
    private void register(ActionEvent e) {
        CardLayout cardLayout = (CardLayout)this.getParent().getLayout();
        cardLayout.show(this.getParent() , "registerPanel");
    }

    //跳转登录界面
    private void login(ActionEvent e) {
        CardLayout cardLayout = (CardLayout)this.getParent().getLayout();
        cardLayout.show(this.getParent() , "loginPanel");
    }

    private void initComponents() {
        // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents  @formatter:off
        titleLabel = new JLabel();
        registerButton = new JButton();
        loginButton = new JButton();

        //======== this ========
        setLayout(null);

        //---- titleLabel ----
        titleLabel.setText("\u6a21\u62df ICBC BAMS \u7ec8\u7aef");
        titleLabel.setHorizontalAlignment(SwingConstants.CENTER);
        titleLabel.setFont(new Font("Microsoft YaHei UI", Font.BOLD, 20));
        add(titleLabel);
        titleLabel.setBounds(105, 140, 275, 65);

        //---- registerButton ----
        registerButton.setText("\u6ce8\u518c");
        registerButton.addActionListener(e -> register(e));
        add(registerButton);
        registerButton.setBounds(120, 325, 78, 34);

        //---- loginButton ----
        loginButton.setText("\u767b\u5f55");
        loginButton.addActionListener(e -> login(e));
        add(loginButton);
        loginButton.setBounds(280, 325, 78, 34);

        setPreferredSize(new Dimension(500, 650));
        // JFormDesigner - End of component initialization  //GEN-END:initComponents  @formatter:on
    }

    // JFormDesigner - Variables declaration - DO NOT MODIFY  //GEN-BEGIN:variables  @formatter:off
    private JLabel titleLabel;
    private JButton registerButton;
    private JButton loginButton;
    // JFormDesigner - End of variables declaration  //GEN-END:variables  @formatter:on
}
